in random order laravel

31

$galleries = App\Gallery::inRandomOrder()->get();
//Or
DB::table('gallery')->inRandomOrder()->get();
$randomUser = DB::table('users')
                ->inRandomOrder()
                ->first();
User::all()->random();
User::all()->random(10); // The amount of items you wish to receive

Comments

Submit
0 Comments